﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using UCL.Powersource.ViewModels;

namespace UCL.Powersource.Views.Dialogs
{
    /// <summary>
    /// Interaction logic for TextDialog.xaml
    /// </summary>
    public partial class ReportingContextDialog : Window
    {
        private ReportingViewModel VM;

        public ReportingContextDialog(ReportingViewModel vm)
        {
            InitializeComponent();

            VM = vm;
        }

        private void OK_Click(object sender, RoutedEventArgs e)
        {
            if (VM.RequestCreateNewReportingContext(NewName.Text))
            {
                this.DialogResult = true;
                this.Close();
            }
            else
            {
                var button = MessageBoxButton.OK;
                var icon = MessageBoxImage.Exclamation;

                var result = System.Windows.MessageBox.Show(VM.NameExistsMsg, VM.NameExistsCaption, button, icon);
            }
        }

        private void Cancel_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
            this.Close();
        }
    }
}
